package com.ggh.jinjilive.ui.mall.shop.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;

import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.SizeUtils;
import com.bumptech.glide.Glide;
import com.ggh.jinjilive.R;
import com.ggh.jinjilive.databinding.ItemMallGoodsBinding;
import com.ggh.jinjilive.databinding.ItemPendingBinding;
import com.ggh.jinjilive.listener.AddItemOnClickListener;
import com.ggh.jinjilive.listener.AddOnClickListener;
import com.ggh.jinjilive.mobile.mall.MallGoods;
import com.ggh.jinjilive.mobile.mall.shop.MineShopOrder;

import java.util.List;

public class PendingAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    private List<MineShopOrder> mineShopOrderList;

    public void setAdd(List<MineShopOrder> mineShopOrderList) {
        this.mineShopOrderList = mineShopOrderList;
        notifyDataSetChanged();
    }

    public void ADD(List<MineShopOrder> mineShopOrderList) {
        if(null !=  this.mineShopOrderList){
            this.mineShopOrderList.addAll(mineShopOrderList);
        }else {
            this.mineShopOrderList = mineShopOrderList;
        }
        notifyDataSetChanged();
    }


    private AddItemOnClickListener addItemOnClickListener;
    public void setAddItemOnClickListener(AddItemOnClickListener addItemOnClickListener) {
        this.addItemOnClickListener = addItemOnClickListener;
    }

    private AddOnClickListener addOnClickListener;
    public void setAddItemOnClickListener(AddOnClickListener addOnClickListener) {
        this.addOnClickListener = addOnClickListener;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        ItemPendingBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_pending, parent, false);
        return new ItemViewHolder(binding);
    }

    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder recyclerViewholder,final int position) {
       if(recyclerViewholder instanceof ItemViewHolder){
            ItemViewHolder holder = (ItemViewHolder) recyclerViewholder;
           MineShopOrder mineShopOrder = mineShopOrderList.get(position);
            if (null != mineShopOrder) {

            }
        }

    }

    @Override
    public int getItemCount() {
        return null == mineShopOrderList ? 0 : mineShopOrderList.size();
    }


    class ItemViewHolder extends RecyclerView.ViewHolder {
        ItemPendingBinding binding;
        public ItemViewHolder(@NonNull ItemPendingBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }
    }

}